package com.hmdp.service;

import com.hmdp.dto.Result;
import com.hmdp.entity.VoucherOrder;
import com.baomidou.mybatisplus.extension.service.IService;

/**
 *用户抢购优惠券
 */
public interface IVoucherOrderService extends IService<VoucherOrder> {

    /**
     * 优惠券秒杀
     * @param voucherId 优惠券id
     * @return 订单id
     */
    Result seckillVoucher(Long voucherId);

    void createVoucherOrder(VoucherOrder voucherOrder);

    /**
     * 前端发起支付请求
     * @param orderId
     * @return
     */
    Result createPayRequest(Long orderId);
    /**
     *前端轮询：查询支付状态
     * @param orderId
     * @return
     */
    Result getPayStatus(Long orderId);
    /**
     * 支付平台回调：支付成功通知
     */
    boolean handlePayCallback(Long orderId, String payNo);

    void doCloseOrder(VoucherOrder voucherOrder);

    void handleCloseOrder(VoucherOrder voucherOrder)throws InterruptedException;
}
